package com.baturu.vin.ford.dal.dao;

import com.baturu.vin.ford.dto.FordV2MGroupDTO;
import com.baturu.vin.ford.dto.FordV2SGroupDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;

/**
 * @Author: chenjiahao
 * @Time: 2019/1/22
 */
public interface FordV2GroupDAO {

    @Select({"SELECT condition1,condition2,mGroup FROM `ford_epc_parts_mgroup`",
            "WHERE idx = #{idx}"})
    List<FordV2MGroupDTO> queryMGroupByIdex(@Param("idx") String idx);

    @Select({"<script>SELECT mainGroup,subGroup,textCondition,condition1,condition2,dealTextCondition,subGroupCondition1,subGroupCondition2,subGroupIdx",
            "FROM ford_epc_parts_subGroup",
            "WHERE idx = #{idx}",
            "AND preSubGroup in ",
            "<foreach item='item' collection = 'mainGroups' open ='( ' separator = ',' close = ')'>",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<FordV2SGroupDTO> querySGroup(@Param("idx") String idx, @Param("mainGroups")Collection<String> dtos);
}
